package com.cn.jms;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.support.MessageBuilder;

public class SendSMS {
    /**
     * 打印日志
     */
    private Logger logger = LoggerFactory.getLogger(SendSMS.class);

    /**
     * 通道
     */
    public MessageChannel sendChannel;

    /**
     * 发送消息
     *
     * @param message
     */
    public void send(String message) {

        if (logger.isDebugEnabled()) {
            logger.debug("接受消息参数为: {}", message);
        }

        Message<?> msg;
        msg = MessageBuilder.withPayload(message).build();
        sendChannel.send(msg);
    }

    public MessageChannel getSendChannel() {
        return sendChannel;
    }

    public void setSendChannel(MessageChannel sendChannel) {
        this.sendChannel = sendChannel;
    }


}
